<?php get_header(); ?>
<?php global $options; foreach ($options as $value) { if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); } } ?>

<?php if($_GET['showLatest'] == "1" || $homeLayout == "Blog") { ?>

<div class="postContainer" style="background: transparent url(<?php bloginfo('template_directory'); ?>/images/bg-pontilhado.gif) repeat-y scroll right top">
	<div class="postsArchive">
		<ul>
		<?php while (have_posts()) : the_post(); ?>
			<li>
				<a href="<?php the_permalink() ?>" class="thumb">
				<?php if($thumbScript == "No") { echo get_thumbnail_noTimThumb($post->ID,"170","125", null); } else { ?>
					<img src="<?php echo get_thumbnail($post->ID,"170","125"); ?>" alt="<?php the_title() ?>" />
				<?php } ?>
				</a>
				<p class="meta"><?php the_time('j \d\e F \d\e Y'); ?><br /><?php comments_popup_link('Deixe um Coment&aacute;rio', '1 Coment&aacute;rio', '% Coment&aacute;rios', 'comments-link', 'Os coment&aacute;riosComments est&atilde;o desabilitados'); ?></p>
				<h3><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
				<p><?php smallerexcerpt('30'); ?>&nbsp;<a href="<?php the_permalink() ?>">Leia mais</a></p>
			</li>
		<?php endwhile; ?> 
		<?php // wp_pagenavi();  ?>
		</ul>
	</div>
</div>

<?php } else { ?>

<?php if (have_posts()) : ?>
      
      <!-- LATEST POSTS CASAMENTO -->
			

			<!-- LATEST POSTS FROM CATEGORY 1 -->
			
			

			<!-- LATEST POSTS FROM CATEGORY 2 -->
			
				
	<?php else : ?>

		<h2>N&atilde;o Encontrado</h2>
		<p>Desculpe, mas nenhum post foi encontrado.</p>
		<?php include (TEMPLATEPATH . '/searchform.php'); ?>
		
				
	<?php endif; ?>
	

	
	<?php if (have_posts()) : ?>

				<?php while (have_posts()) : the_post(); ?>		
      		<div class="postContainer">
      				<div class="post">
      			    <h3 style="margin:0; "><a href="<?php the_permalink() ?>" style="color: #263a6d; "><?php the_title() ?></a></h3>
      					<div class="entry">
      			    <p class="meta" style="margin-bottom:15px;">Postado em <?php the_time('j'); ?><?php if (get_the_time('j') == 1) { echo '&ordm;'; } ?>/<?php the_time('m/Y'); ?> por <?php the_author(); ?> </p>
      					<?php the_content(); ?>
      					<p><?php edit_post_link('Editar', '', ' | '); ?><?php the_tags('<b>Tags: </b>', ', ', '<br />'); ?> </p>
      					
                        
                        <p class="meta" style="margin-bottom: 35px;">Postado em <?php echo get_the_category_list(', ') ?> | <?php comments_popup_link('Deixe um Coment&aacute;rio', '1 Coment&aacute;rio', '% Coment&aacute;rios', 'comments-link', 'Os coment&aacute;riosComments est&atilde;o desabilitados'); ?></p>
      				</div>
      			</div>
      		</div>
				<?php endwhile; ?> 
				
				<div class="navigation">
					<div class="alignleft"><?php next_posts_link(__('&laquo; Posts Mais Antigos', 'kubrick')) ?></div>
					<div class="alignright"><?php previous_posts_link(__('Posts Mais Novos &raquo;', 'kubrick')) ?></div>
				</div>
				
								
	<?php else : 
	
	if ( is_category() ) { // If this is a category archive
			printf("<h2>Desculpe, mas n&atilde;o h&aacute; nenhum post nesta categoria.</h2>", single_cat_title('',false));
		} else if ( is_date() ) { // If this is a date archive
			echo("<h2>Desculpe, mas n&atilde;o h&aacute; nenhum post nesta data.</h2>");
		} else if ( is_author() ) { // If this is a category archive
			$userdata = get_userdatabylogin(get_query_var('author_name'));
			printf("<h2>Desculpe, mas n&atilde;o h&aacute; nenhum post escrito por %s.</h2>", $userdata->display_name);
		} else {
			echo("<h2>Nenhum post encontrado.</h2>");
		}
		
		include (TEMPLATEPATH . '/searchform.php');
		
	endif; ?>


<?php } ?>
<?php if($useGeneralSidebar == "No") { get_sidebar('home'); } else { get_sidebar(); } ?>
<?php get_footer(); ?>